package org.example.crazy.z_factory_model.product;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @Author yzz
 * @CreateTime 2025/04/19
 * @描述: Apple 具体产品类-苹果。加上 @Component 后Spring会将此类的小驼峰命名为对象名，
 * 也就是当注入时，apple 就是此对象的名称，也是 beanName
 */
@Component
public class Apple extends AbstractFruit implements BeanPostProcessor {
    @Override
    public void eat() {
        System.out.println("吃苹果");
    }

    /**
     * 会输出项目中所有的Bean 信息
     * @param bean
     * @param beanName
     * @return
     * @throws BeansException
     */
    /*@Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("Bean initialized: " + beanName + " (Type: " + bean.getClass().getName() + ")");
        return bean;
    }*/
}
